package com.tql;

import redis.clients.jedis.Jedis;

public class TestZset {
    public static void main(String[] args) {
        Jedis jedis=new Jedis("127.0.0.1",6379);
        jedis.flushDB();
        //添加数据,score 相当于权重，权重小的在数据前面
        System.out.println(jedis.zadd("key1",15.0,"hisir"));
        System.out.println(jedis.zadd("key1",50,"jfksj"));
        System.out.println(jedis.zadd("key1",5,"nfak"));
        System.out.println("查询全部"+jedis.zrange("key1",0,-1));
        System.out.println("显示全部通过score排序"+jedis.zrangeByScoreWithScores("key1",0,-1));
        System.out.println(jedis.zrange("key1",0,-1));
        System.out.println(jedis.zrangeByScoreWithScores("key1","-inf","+inf"));

    }
}
